#pragma once

template <class T>
class feSingleton
{
protected:
	static T* Instance;

protected:
	feSingleton( const feSingleton& Src){}
	feSingleton& operator=( const feSingleton& Src){};
	feSingleton(){ Instance = 0; }


public:	
	~feSingleton()
	{
		if(Instance)
			delete Instance;
		Instance = 0;
	}

	static T& GetInstance()
	{
		if(!Instance)
			Instance = new T();
		return (*Instance);
	}
};

template <class T> T* feSingleton<T>::Instance = 0;
